<?php 

// ** Documentation
/*______________________________________________________________________________

	Package Driver

	Last Update: Dec 2006
	Author: Tom Atwell (klenwell@gmail.com)

  NOTES	

______________________________________________________________________________*/


// ** Initialize Driver
/*____________________________________________________________________________*/

	// globals
	global $GREQO;
	
	// internal
	$GREQO = array();
	$GREQO['session_id'] = 'GRQ';
	
	// paths
	$GREQO['this_dir'] = dirname(realpath(__FILE__));
	$GREQO['parent_dir'] = dirname($GREQO['this_dir']);
	$GREQO['root'] = $GREQO['this_dir'] . DIRECTORY_SEPARATOR;
	$GREQO['lib'] = $GREQO['root'] . 'greqo' . DIRECTORY_SEPARATOR;
	$GREQO['magpie'] = $GREQO['root'] . 'magpierss' . DIRECTORY_SEPARATOR . 'rss_fetch.inc';

/*____________________________________________________________________________*/


// ** Package File Stack

	$GREQO['STACK'] = array
	(
		$GREQO['lib'] . 'greqo_auth.lib.inc.php',
		$GREQO['lib'] . 'greqo_blogger.lib.inc.php',
		$GREQO['lib'] . 'greqo_atom.lib.inc.php',
		$GREQO['lib'] . 'greqo_blogger_request.lib.inc.php',
		$GREQO['lib'] . 'greqo_blogger_express.lib.inc.php',
	);

	
// ** Data

	// Greqo Global Settings
	$GREQO['client_id'] = 'Klenwell-Greqo-0.7';
	
	// Greqo Global Google Data Settings
	$GREQO['clientlogin_url'] = 'https://www.google.com/accounts/ClientLogin';

	// Greqo Global Blogger Settings
	$GREQO['BLOGGER']['request_url'] = 'http://www.blogger.com/feeds/default/blogs';
	$GREQO['BLOGGER']['api_version'] = 0;
	$GREQO['BLOGGER']['api_url'] = 'http://www.blogger.com';
	
	// Greqo Session Values
	$_SESSION['GDATA']['auth_token'] = ( isset($_SESSION['GDATA']['auth_token']) ) ? $_SESSION['GDATA']['auth_token']: 0;
	$_SESSION['GDATA']['BLOGGER']['api_url'] = ( isset($_SESSION['GDATA']['BLOGGER']['api_url']) ) ? $_SESSION['GDATA']['BLOGGER']['api_url'] : '';



// ** Controller

	// set constants
	define('GREQO_ID', $GREQO['session_id']);
	define('GREQO_ROOT', $GREQO['root']);
	define('GREQO_LIB', $GREQO['lib']);
	define('MAGPIE_PATH', $GREQO['magpie']); 


// ** Load Stack

	foreach ( $GREQO['STACK'] as $_file ) 
	{
		$_path = $_file;
		include_once($_path);
	}
	
	
// ** Load Notice (for AMVC framework)

	$AMVC['STDOUT'][] = "greqo package loaded";
	
?>
